<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="${request.contextPath}/statics/css/main.css">
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/element/element.css">
<link rel="stylesheet" href="${request.contextPath}/statics/css/ziyun-erp.css">


<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
<script src="${request.contextPath}/statics/js/common1.js"></script>
<script src="${request.contextPath}/statics/plugins/element/element.js"></script>
<script src="${request.contextPath}/statics/libs/ajaxhook.min.js"></script>



<script>
    hookAjax({
        //拦截回调
       /* onreadystatechange:function(xhr){
            console.log("onreadystatechange called: %O",xhr)
        },*/
        onload:function(xhr){
            var responseObj = tryParseJson1(xhr);
            if(responseObj){
                if(responseObj.code === 501){ //在其他地方登陆
                    location.href = "/login.html?kicout=1";
                }
            }
            //console.log("onload called: %O",xhr)
        },
        //拦截方法
        /*open:function(arg,xhr){
            console.log("open called: method:%s,url:%s,async:%s",arg[0],arg[1],arg[2])
        }*/
    })
    function tryParseJson1(xhr){
        var contentType=xhr.getResponseHeader("content-type")||"";
        if(contentType.toLocaleLowerCase().indexOf("json")!==-1){
            return JSON.parse(xhr.responseText);
        }
        if(contentType.toLocaleLowerCase().indexOf("html")!==-1){ //ajax 请求返回页面则手动跳转页面
            location = xhr.responseURL;
        }
    }
</script>
